package flyweight.extrinsic;

import java.util.*;

public class DeviceFactory
{
	private Map<String,NetworkDevice> devicePool = new HashMap<>();
	private int totalUsageCount=0;
	
	public DeviceFactory()
	{

		devicePool.put("cisco", new Switch("Cisco-WS-C2950-24"));
		devicePool.put("tp", new Hub("TP-LINK-HF8M"));

	}
	public  NetworkDevice getNetworkDevice(String type){
		NetworkDevice device = devicePool.get(type.toLowerCase());
		if(device != null){
			totalUsageCount++;
		}
		return device;

	}

	
	public int getTotalDevice()
	{
		return devicePool.size();
	}
	
	public int getTotalUsageCount()
	{
		return totalUsageCount;
	}
}